package com.master.demo.example.funcation;

/**
 * 说明
 *
 * @author: Yang
 * @date: 2022/1/7
 * @version: 1.0.0
 * Copyright Ⓒ 2021 恒翔 Computer Corporation Limited All rights reserved.
 */
public class ThrowExceptionExample {

    public static void main(String[] args) {
        isTure(false).throwMessage("test");
    }


    /**
     *  如果参数为true抛出异常
     *
     * @param b
     * @return com.example.demo.func.ThrowExceptionFunction
     **/
    public static ThrowException isTure(boolean b){

        return (errorMessage) -> {
            if (b){
                throw new RuntimeException(errorMessage);
            }
        };
    }
}
